package com.jadefashion.service.impl;

import com.jadefashion.mapper.MemberMapper;
import com.jadefashion.pojo.Member;
import com.jadefashion.service.MemberService;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

@Service(timeout = 5000)
@Transactional
public class MemberServiceImpl implements MemberService {
    @Autowired
    MemberMapper memberMapper;
    @Override
    public void add(Member member) {
        memberMapper.add(member);
    }


        @Override
        public void addMemberByPhone(String telephone) {
            Member member = new Member();
            member.setPhoneNumber(telephone);
            Integer newMember = memberMapper.isNewMember(telephone);
            if(newMember==null){//新用户
                memberMapper.add(member);
            }
        }

    @Override
    public Member findMemberByTelephone(String telephone) {
        return memberMapper.findMemberByTelephone(telephone);
    }
}
